public class MainClass4 {
    //汉诺塔相关代码

    /**
     * @param args
     */
    public static void main(String[] args) {
        int nDisks = 3;
        doTowers(nDisks, 'A', 'B', 'C');
    }

    /**
     * 汉诺塔
     *
     * @param topN  从上往下数，第几个盘子 ，比如3个盘子，一开始都放在A柱子山，标号 1，2，3
     * @param from
     * @param inter
     * @param to
     * @see chapter07.HanoiTower
     * @see <a href="https://www.runoob.com/java/method-tower.html">...</a>
     */
    public static void doTowers(int topN, char from, char inter, char to) {
        if (topN == 1) {
            System.out.println("Disk 1 from " + from + " to " + to);
        } else {
            //------------------
            doTowers(topN - 1, from, to, inter);
            System.out.println("Disk " + topN + " from " + from + " to " + to);
            doTowers(topN - 1, inter, from, to);
        }
    }
}
